Eclipse Platform
Pre-release 3.0

org.eclipse.jface.text.source
Class Annotation

java.lang.Object
  extended byorg.eclipse.jface.text.source.Annotation
Direct Known Subclasses:
DefaultAnnotation, DefaultRangeIndicator, MarkerAnnotation, ProjectionAnnotation

public class Annotation
extends Object

Annotation managed by an IAnnotationModel. Annotations are considered being located at layers and are considered being painted starting with layer 0 upwards. Thus an annotation of layer 5 will be drawn on top of all co-located annotations at the layers 4 - 0. Subclasses must provide the annotations paint method.

See Also:
IVerticalRuler

Field Summary
static String TYPE_UNKNOWN
           
 
Constructor Summary
protected Annotation()
          Creates a new annotation that is not persistent and type less.
  Annotation(boolean isPersistent)
          Creates a new annotation.
  Annotation(String type, boolean isPersistent, String text)
          Creates a new annotation with the given properties.
 
Method Summary
protected static void drawImage(Image image, GC gc, Canvas canvas, Rectangle r, int align)
          Convenience method for drawing an image aligned inside a rectangle.
protected static void drawImage(Image image, GC gc, Canvas canvas, Rectangle r, int halign, int valign)
          Convenience method for drawing an image aligned inside a rectangle.
 int getLayer()
          Deprecated. use IAnnotationAccessExtension.getLayer(Annotation)
 String getText()
          Returns the text associated with this annotation.
 String getType()
          Returns the type of the annotation.
 boolean isMarkedDeleted()
          Returns whether this annotation is marked as deleted.
 boolean isPersistent()
          Returns whether this annotation is persistent.
 void markDeleted(boolean deleted)
          Marks this annotation deleted according to the value of the deleted parameter.
 void paint(GC gc, Canvas canvas, Rectangle bounds)
          Deprecated. use IAnnotationAccessExtension.paint(Annotation, GC, Canvas, Rectangle)
protected  void setLayer(int layer)
          Deprecated. since 3.0
 void setText(String text)
          Sets the text associated with this annotation.
 void setType(String type)
          Sets the type of this annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_UNKNOWN

public static final String TYPE_UNKNOWN
See Also:
Constant Field Values
Constructor Detail

Annotation

protected Annotation()
Creates a new annotation that is not persistent and type less.


Annotation

public Annotation(String type,
                  boolean isPersistent,
                  String text)
Creates a new annotation with the given properties.

Parameters:
type - the type of this annotation
isPersistent - true if this annotation is persistent, false otherwise
text - the text associated with this annotation
Since:
3.0

Annotation

public Annotation(boolean isPersistent)
Creates a new annotation.

Parameters:
isPersistent - true if persistent, false otherwise
Since:
3.0
Method Detail

drawImage

protected static void drawImage(Image image,
                                GC gc,
                                Canvas canvas,
                                Rectangle r,
                                int halign,
                                int valign)
Convenience method for drawing an image aligned inside a rectangle.

Parameters:
image - the image to be drawn
canvas - the canvas on which to draw
r - the clipping rectangle
halign - the horizontal alignment of the image to be drawn
valign - the vertical alignment of the image to be drawn

drawImage

protected static void drawImage(Image image,
                                GC gc,
                                Canvas canvas,
                                Rectangle r,
                                int align)
Convenience method for drawing an image aligned inside a rectangle.

Parameters:
image - the image to be drawn
canvas - the canvas on which to draw
r - the clipping rectangle
align - the alignment of the image to be drawn

isPersistent

public boolean isPersistent()
Returns whether this annotation is persistent.

Returns:
true if this annotation is persistent, false otherwise
Since:
3.0

setType

public void setType(String type)
Sets the type of this annotation.

Parameters:
type - the annotation type
Since:
3.0

getType

public String getType()
Returns the type of the annotation.

Returns:
the type of the annotation
Since:
3.0

markDeleted

public void markDeleted(boolean deleted)
Marks this annotation deleted according to the value of the deleted parameter.

Parameters:
deleted - true if annotation should be marked as deleted
Since:
3.0

isMarkedDeleted

public boolean isMarkedDeleted()
Returns whether this annotation is marked as deleted.

Returns:
true if annotation is marked as deleted, false otherwise
Since:
3.0

setText

public void setText(String text)
Sets the text associated with this annotation.

Parameters:
text - the text associated with this annotation
Since:
3.0

getText

public String getText()
Returns the text associated with this annotation.

Returns:
the text associated with this annotation or null
Since:
3.0

setLayer

protected void setLayer(int layer)
Deprecated. since 3.0

Sets the layer of this annotation.

Parameters:
layer - the layer of this annotation

getLayer

public int getLayer()
Deprecated. use IAnnotationAccessExtension.getLayer(Annotation)

Returns the annotations drawing layer.

Returns:
the annotations drawing layer

paint

public void paint(GC gc,
                  Canvas canvas,
                  Rectangle bounds)
Deprecated. use IAnnotationAccessExtension.paint(Annotation, GC, Canvas, Rectangle)

Implement this method to draw a graphical representation of this annotation within the given bounds. This default implementation does nothing.

Parameters:
canvas - the canvas to draw on
bounds - the bounds inside the canvas to draw on

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.